﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Smartmanufact
{
    public partial class CutomerEdit : Form
    {
        public string origincutsomer_id = "";
        public string originname = "";
        public string origincompany = "";
        public string originphone = "";
        public string originemail = "";
        
        public CutomerEdit()
        {
            InitializeComponent();
        }

        private void CutomerEdit_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        public void Fill_info()
        {
            label_id.Text = origincutsomer_id;
            textBox_name.Text = originname;
            textBox_company.Text = origincompany;
            textBox_phone.Text = originphone;
            textBox_email.Text = originemail;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string id = label_id.Text.Trim();
            string name = textBox_name.Text.Trim();
            string company = textBox_company.Text.Trim();
            string phone = textBox_phone.Text.Trim();
            string email = textBox_email.Text.Trim();
            if (textBox_name.Text.Trim() == "") { MessageBox.Show("名字不能为空"); return; }
            MainView.mysql.excute_sql("update customertable set customerID='" + id + "',name='" + name + "',company='" + company + "',phone='" + phone + "',email='" + email + "' where customerID='"+origincutsomer_id+"'");
            this.Dispose();
        }
    }
}
